layui.define(["form", "layer", "admin", "table", "upload", "element", "laydate"], function (exports) {
    var $ = layui.$,
        form = layui.form,
        layer = layui.layer,
        admin = layui.admin,
        table = layui.table,
        laydate = layui.laydate;

    var tableOption = {
        toolbar: "#bil-store-express-list-table-toolbar-tmp",
        defaultToolbar: [],
        cols: [[
            {type: "checkbox"},
            {field: 'id', title: 'ID', width: 80, hide: true},
            {field: 'waybillNo', title: '运单号', width: 160},
            {field: 'username', title: '发件人', width: 140},
            {field: 'channelCode', title: '渠道', hide: true},
            {field: 'channelName', title: '渠道', width: 120},
            {field: 'storeCode', title: '仓库', hide: true},
            {field: 'storeName', title: '仓库', width: 140},
            {field: 'receiverId', title: '收件人', hide: true},
            {field: 'receiverName', title: '收件人'},
            {field: 'expressNo', title: '快递号', width: 140},
            {field: 'state', title: '状态', templet: '#bil-store-express-list-table-state-tmp'},
            {field: 'createTime', title: '订单时间'},
            {title: '操作', width: 200, templet: '#bil-store-express-list-table-operate-tmp'}
        ]],
        page: true,
        limit: 50
    }

    laydate.render({
        elem: '#bil-store-express-list-query-form input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-1 input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-2 input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-3 input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-4 input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-5 input[name=expressDate]', //指定元素
        range: "~"
    });

    laydate.render({
        elem: '#bil-store-express-list-query-form-7 input[name=expressDate]', //指定元素
        range: "~"
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {},
        done: function (res) {
            $("#bil-store-express-list-table-all-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "1"},
        done: function (res) {
            $("#bil-store-express-list-table-1-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "2"},
        done: function (res) {
            $("#bil-store-express-list-table-2-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "3"},
        done: function (res) {
            $("#bil-store-express-list-table-3-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "4"},
        done: function (res) {
            $("#bil-store-express-list-table-4-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "5,6"},
        done: function (res) {
            $("#bil-store-express-list-table-5-count").html(res.data);
        }
    });

    admin.req({
        url: "/bil/countBilExpress",
        data: {"states": "7"},
        done: function (res) {
            $("#bil-store-express-list-table-7-count").html(res.data);
        }
    });

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-all",
        elem: '#bil-store-express-list-table-all',
        url: "/bil/listBilExpress",
        where: {
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-1",
        elem: '#bil-store-express-list-table-1',
        url: "/bil/listBilExpress",
        where: {
            states: "1",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-2",
        elem: '#bil-store-express-list-table-2',
        toolbar: "#bil-store-express-list-table-toolbar-tmp2",
        url: "/bil/listBilExpress",
        where: {
            states: "2",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-3",
        elem: '#bil-store-express-list-table-3',
        url: "/bil/listBilExpress",
        where: {
            states: "3",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-4",
        elem: '#bil-store-express-list-table-4',
        url: "/bil/listBilExpress",
        where: {
            states: "4",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-5",
        elem: '#bil-store-express-list-table-5',
        url: "/bil/listBilExpress",
        where: {
            states: "5,6",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.render($.extend({}, tableOption, {
        id: "bil-store-express-list-table-7",
        elem: '#bil-store-express-list-table-7',
        url: "/bil/listBilExpress",
        where: {
            states: "7",
            access_token: layui.data('layuiAdmin').access_token
        }
    }));

    table.on("tool(bil-store-express-list-table-all)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-1)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-2)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-3)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-4)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-5)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    table.on("tool(bil-store-express-list-table-7)", function (obj) {
        if (obj.event === "follow") {
            openLogisticsList(obj);
        } else if (obj.event === "delete") {
            deleteBilExpress(obj);
        }
    });

    $("body").off("keydown").on("keydown", function (e) {
        var nextCode = window.event ? window.event.keyCode : e.which;
        if (nextCode === 13) {// enter
            var waybillNo = $("#express-list-confirm-btn").find("input").val();
            if (waybillNo && waybillNo.indexOf("TDC") !== -1) {
                waybillNo = waybillNo.trim();
                waybillNo = waybillNo.substring(waybillNo.length - 13, waybillNo.length);
                admin.req({
                    url: "/bil/getBilExpress",
                    data: {"waybillNo": waybillNo},
                    done: function (res) {
                        var bil = res.data;
                        if (bil && bil.expressNo) {
                            if (bil.state == "2") {
                                window.open(layui.setter.base + 'views/bil/expressPrintZT.html?ids=' + waybillNo, "_blank");
                                $("#express-list-confirm-btn").find("input").val("")
                            } else {
                                layer.msg("只有分店已收件状态下的运单才可打印面单", {icon: 5, time: 2000});
                            }
                        } else {
                            layer.msg("只能打印有快递号的数据", {icon: 5, time: 2000});
                        }
                    }
                });
            } else if (waybillNo) {
                layer.msg("扫描或者输入有误，请重新扫描", {icon: 5, time: 2000});
            }
        }
    });

    table.on('toolbar(bil-store-express-list-table-all)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-all');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-all');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    table.on('toolbar(bil-store-express-list-table-1)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-1');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-1');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    table.on('toolbar(bil-store-express-list-table-2)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-2');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-2');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        } else if (obj.event === "printbar") {
            openExpressPrintZT2();
        }
    });

    table.on('toolbar(bil-store-express-list-table-3)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-3');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-3');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    table.on('toolbar(bil-store-express-list-table-4)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-4');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-4');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    table.on('toolbar(bil-store-express-list-table-5)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-5');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-5');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    table.on('toolbar(bil-store-express-list-table-7)', function (obj) {
        if (obj.event === "state") {
            openExpressStateUpdate(obj);
        } else if (obj.event === "print") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-7');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }
            openExpressPrint(checkStatus.data);
        } else if (obj.event === "printzt") {
            var checkStatus = table.checkStatus('bil-store-express-list-table-7');
            if (checkStatus.data.length === 0) {
                layer.msg("请选择需要打印的数据", {icon: 5, time: 1500});
                return;
            }

            var isValid = true;
            $.each(checkStatus.data, function (index, item) {
                if (!item.expressNo) {
                    isValid = false;
                }
            });
            if (!isValid) {
                layer.msg("只能打印有快递号的数据", {icon: 5, time: 1500});
                return;
            }

            openExpressPrintZT(checkStatus.data);
        }
    });

    form.on("submit(bil-store-express-list-query-submit)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-all", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-1)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "1";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-1", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-2)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "2";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-2", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-3)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "3";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-3", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-4)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "4";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-4", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-5)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "5,6";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-5", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-query-submit-7)", function (obj) {
        layer.load(2, {time: 100 * 1000});

        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;
        data["states"] = "7";
        var expressDate = data["expressDate"];
        if (expressDate) {
            data["startDate"] = expressDate.split("~")[0].trim();
            data["endDate"] = expressDate.split("~")[1].trim();
        }

        table.reload("bil-store-express-list-table-7", {
            where: data,
            page: {
                curr: 1
            },
            done: function () {
                layer.closeAll('loading');
            }
        });

        return false;
    });

    form.on("submit(bil-store-express-list-export-submit)", function (obj) {
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-1)", function (obj) {
        obj.field.states = "1";
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-2)", function (obj) {
        obj.field.states = "2";
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-3)", function (obj) {
        obj.field.states = "3";
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-4)", function (obj) {
        obj.field.states = "4";
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-5)", function (obj) {
        obj.field.states = "5,6";
        exportBilExpress(obj);
    });

    form.on("submit(bil-store-express-list-export-submit-7)", function (obj) {
        obj.field.states = "7";
        exportBilExpress(obj);
    });

    function openLogisticsList(obj) {
        layer.open({
            type: 2,
            title: "运单物流信息",
            area: ['800px', '500px'],
            content: layui.setter.base + 'views/bil/logisticsList.html?waybillNo=' + obj.data.waybillNo,
            cancel: function (index, layero) {
                layer.close(index);
                return false;
            }
        });
    }

    function deleteBilExpress(obj) {
        layer.confirm('确定要删除吗?', {icon: 3, title: '提示'}, function (index) {
            layer.close(index);

            var data = {"waybillNo": obj.data.waybillNo};
            admin.req({
                url: "/bil/deleteBilExpress",
                data: data,
                beforeSend: function () {
                    layer.load(2, {time: 100 * 1000});
                },
                complete: function () {
                    layer.closeAll('loading');
                },
                done: function () {
                    $("#bil-store-express-list-query-btn").trigger("click");
                    $("#bil-store-express-list-query-btn-1").trigger("click");
                    $("#bil-store-express-list-query-btn-2").trigger("click");
                    $("#bil-store-express-list-query-btn-3").trigger("click");
                    $("#bil-store-express-list-query-btn-4").trigger("click");
                    $("#bil-store-express-list-query-btn-5").trigger("click");
                    $("#bil-store-express-list-query-btn-7").trigger("click");
                }
            });
        });
    }

    function openExpressStateUpdate(obj) {
        layer.open({
            type: 2,
            title: "运单状态",
            area: ['1200px', '600px'],
            content: layui.setter.base + 'views/bil/expressStateUpdate.html',
            cancel: function (index, layero) {
                layer.close(index);
                $("#bil-store-express-list-query-btn").trigger("click");
                $("#bil-store-express-list-query-btn-1").trigger("click");
                $("#bil-store-express-list-query-btn-2").trigger("click");
                $("#bil-store-express-list-query-btn-3").trigger("click");
                $("#bil-store-express-list-query-btn-4").trigger("click");
                $("#bil-store-express-list-query-btn-5").trigger("click");
                $("#bil-store-express-list-query-btn-7").trigger("click");
                return false;
            }
        });
    }

    function openExpressPrint(data) {
        var ids = "";
        $.each(data, function (index, item) {
            if (index === data.length - 1) {
                ids = ids + item.id;
            } else {
                ids = ids + item.id + ",";
            }
        });

        window.open(layui.setter.base + 'views/bil/expressPrint.html?ids=' + ids, "_blank");
    }

    function openExpressPrintZT(data) {
        var ids = "";
        $.each(data, function (index, item) {

            if (index === data.length - 1) {
                ids = ids + item.id;
            } else {
                ids = ids + item.id + ",";
            }
        });

        window.open(layui.setter.base + 'views/bil/expressPrintZT.html?ids=' + ids, "_blank");
    }

    function openExpressPrintZT2() {
        layer.prompt({"id": "express-list-confirm-btn"}, function (waybillNo, index, elem) {
            waybillNo = waybillNo.trim();
            if (waybillNo && waybillNo.indexOf("TDC") !== -1) {
                admin.req({
                    url: "/bil/getBilExpress",
                    data: {"waybillNo": waybillNo},
                    done: function (res) {
                        var bil = res.data;
                        if (bil.expressNo) {
                            window.open(layui.setter.base + 'views/bil/expressPrintZT.html?ids=' + waybillNo, "_blank");
                            $("#express-list-confirm-btn").find("input").val("");
                        } else {
                            layer.msg("只能打印有快递号的数据", {icon: 5, time: 2000});
                        }
                    }
                });
            } else {
                layer.msg("扫描或者输入有误，请重新扫描", {icon: 5, time: 2000});
            }
        });
    }

    function exportBilExpress(obj) {
        var url = "/bil/exportBilExpress";
        var data = obj.field;
        data["access_token"] = layui.data('layuiAdmin').access_token;

        var exportForm = $('<form>');
        exportForm.attr("style", "display:none");
        exportForm.attr('target', '');
        exportForm.attr('method', 'post');
        exportForm.attr('action', url);
        $.each(data, function (key, value) {
            if (value.trim().length !== 0) {
                var input = $("<input type='hidden'/>");
                input.attr("name", key);
                input.val(value);
                exportForm.append(input);
            }
        });

        $("body").append(exportForm);
        exportForm.submit();
    }

    table.render({
        elem: '#bil-store-express-list-table-create',
        url: "/bil/listBilExpress",
        cols: [[
            {field: 'id', title: 'ID', width: 80, hide: true},
            {field: 'waybillNo', title: '运单号'},
            {field: 'channelCode', title: '渠道', hide: true},
            {field: 'channelName', title: '渠道'},
            {field: 'storeCode', title: '仓库', hide: true},
            {field: 'storeName', title: '仓库'},
            {field: 'receiverId', title: '收件人', hide: true},
            {field: 'receiverName', title: '收件人'},
            {field: 'state', title: '状态', hide: true},
            {field: 'stateDescription', title: '状态'},
            {title: '操作', width: 200, templet: '#bil-store-express-list-table-operate-tmp'}
        ]],
        id: 'bil-store-express-list-table-create',
        page: true,
        limit: 50,
        where: {
            access_token: layui.data('layuiAdmin').access_token,
            status: "create"
        }
    });

    exports("expressStoreList", {});
});